package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

/**
 * @Author Justin Parker
 * @Date 2024/7/17 0017 10:14
 * @Version 1.0
 */
public class OutputStreamWriterDemo01 {
    public static void main(String[] args) throws IOException {
        //1.构建字符转换流输出对象
        OutputStreamWriter osw =
                new OutputStreamWriter(
                        new FileOutputStream("./ow.txt", true),
                        StandardCharsets.UTF_8);
        //2.写数据（字符串）
        osw.write("你好，我是Java程序员");
        osw.write("大雷");
        System.out.println("数据写出完毕");
        //3.关闭流对象
        osw.close();
    }
}
